package com.model.责任链;




// 初级审批处理器
public class  JuniorManager extends Handler {
    @Override
    public void handleRequest(Request request) {
        if (request.getAmount() <= 1000) {
            System.out.println("Junior Manager approves $" + request.getAmount());
        } else if (nextHandler != null) {
            nextHandler.handleRequest(request);
        }
    }
}


// 高级审批处理器
class SeniorManager extends Handler {
    @Override
    public void handleRequest(Request request) {
        if (request.getAmount() <= 5000) {
            System.out.println("Senior Manager approves $" + request.getAmount());
        } else if (nextHandler != null) {
            nextHandler.handleRequest(request);
        }
    }
}

// 高级审批处理器
class Director extends Handler {
    @Override
    public void handleRequest(Request request) {
        if (request.getAmount() <= 10000) {
            System.out.println("Director approves $" + request.getAmount());
        } else {
            System.out.println("Request for $" + request.getAmount() + " requires board meeting!");
        }
    }
}